package com.cui.project.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 接口流量预测结果表
 * @TableName user_interface_traffic_forecast
 */
@TableName(value ="user_interface_traffic_forecast")
@Data
public class UserInterfaceTrafficForecast implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 接口ID
     */
    @TableField(value = "interface_info_id")
    private Long interfaceInfoId;

    /**
     * 预测时间点
     */
    @TableField(value = "forecast_time")
    private Date forecastTime;

    /**
     * 预测请求量
     */
    @TableField(value = "forecast_request_count")
    private Integer forecastRequestCount;

    /**
     * 置信区间下界
     */
    @TableField(value = "confidence_lower")
    private Integer confidenceLower;

    /**
     * 置信区间上界
     */
    @TableField(value = "confidence_upper")
    private Integer confidenceUpper;

    /**
     * 预测模型类型（ARIMA/Prophet/LSTM等）
     */
    @TableField(value = "model_type")
    private String modelType;

    /**
     * 模型版本
     */
    @TableField(value = "model_version")
    private String modelVersion;

    /**
     * 模型准确度评分
     */
    @TableField(value = "accuracy_score")
    private BigDecimal accuracyScore;

    /**
     * 创建时间
     */
    @TableField(value = "created_at")
    private Date createdAt;

    /**
     * 预测日期（用于分区）
     */
    @TableField(value = "forecast_date")
    private Date forecastDate;

    /**
     * 
     */
    @TableField(value = "user_id")
    private Long userId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserInterfaceTrafficForecast other = (UserInterfaceTrafficForecast) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getInterfaceInfoId() == null ? other.getInterfaceInfoId() == null : this.getInterfaceInfoId().equals(other.getInterfaceInfoId()))
            && (this.getForecastTime() == null ? other.getForecastTime() == null : this.getForecastTime().equals(other.getForecastTime()))
            && (this.getForecastRequestCount() == null ? other.getForecastRequestCount() == null : this.getForecastRequestCount().equals(other.getForecastRequestCount()))
            && (this.getConfidenceLower() == null ? other.getConfidenceLower() == null : this.getConfidenceLower().equals(other.getConfidenceLower()))
            && (this.getConfidenceUpper() == null ? other.getConfidenceUpper() == null : this.getConfidenceUpper().equals(other.getConfidenceUpper()))
            && (this.getModelType() == null ? other.getModelType() == null : this.getModelType().equals(other.getModelType()))
            && (this.getModelVersion() == null ? other.getModelVersion() == null : this.getModelVersion().equals(other.getModelVersion()))
            && (this.getAccuracyScore() == null ? other.getAccuracyScore() == null : this.getAccuracyScore().equals(other.getAccuracyScore()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getForecastDate() == null ? other.getForecastDate() == null : this.getForecastDate().equals(other.getForecastDate()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getInterfaceInfoId() == null) ? 0 : getInterfaceInfoId().hashCode());
        result = prime * result + ((getForecastTime() == null) ? 0 : getForecastTime().hashCode());
        result = prime * result + ((getForecastRequestCount() == null) ? 0 : getForecastRequestCount().hashCode());
        result = prime * result + ((getConfidenceLower() == null) ? 0 : getConfidenceLower().hashCode());
        result = prime * result + ((getConfidenceUpper() == null) ? 0 : getConfidenceUpper().hashCode());
        result = prime * result + ((getModelType() == null) ? 0 : getModelType().hashCode());
        result = prime * result + ((getModelVersion() == null) ? 0 : getModelVersion().hashCode());
        result = prime * result + ((getAccuracyScore() == null) ? 0 : getAccuracyScore().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getForecastDate() == null) ? 0 : getForecastDate().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", interfaceInfoId=").append(interfaceInfoId);
        sb.append(", forecastTime=").append(forecastTime);
        sb.append(", forecastRequestCount=").append(forecastRequestCount);
        sb.append(", confidenceLower=").append(confidenceLower);
        sb.append(", confidenceUpper=").append(confidenceUpper);
        sb.append(", modelType=").append(modelType);
        sb.append(", modelVersion=").append(modelVersion);
        sb.append(", accuracyScore=").append(accuracyScore);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", forecastDate=").append(forecastDate);
        sb.append(", userId=").append(userId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}